﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Common.EventHandler;
using Domain.Common;
using Microsoft.Xna.Framework;
using Service;
using UIComponentSprite.SmallMap;

namespace UIComponentSprite.Screen
{
   public class StartBtnSprite:UserControlledSprite
   {
       private PauseBtnSprite _pauseBtnSprite;
       public StartBtnSprite(string imgUrl,PauseBtnSprite pauseBtnSprite)
       {
           this._pauseBtnSprite = pauseBtnSprite;
           this.ClickLeftEvent += new ClickLeftEventHandler(ClickLeftEventHandler);
           this.ImgUrl = imgUrl;
           DrawPosition.Width = 35;
           DrawPosition.Height = 35;
       }
        public override void Draw(GameTime gameTime)
        {
            if (!Showing)
                return;
            SpriteBatch.Draw(this.Image, DrawPosition, Color.White);
        }

        public override void Update(GameTime gameTime)
        {
            if (!Showing)
                return;
            LoadPic();
            DrawPosition.X = 50;
            DrawPosition.Y = GameScreen.ViewportSize.Y - DrawPosition.Height;
            ClickLeftEventListener(null);
        }
        /// <summary>
        /// 鼠标左键单击事件处理器
        /// </summary>
        /// <param name="args"></param>
        public override void ClickLeftEventHandler(object args)
        {
            SetShowing(false);
            _pauseBtnSprite.SetShowing(true);
            GameService.StartGameSync();
        }
     
    }
}
